package com.gc.jbnfgen.gen;

import com.google.common.base.Joiner;

/**
 *
 * @author dmitry.mamonov
 */
public class Alternative extends JBNF {

    public Alternative(String name) {
        super(name);
    }

    @Override
    public String toString() {
        if (isPrinted()) {
            return "<"+getName()+">";
        } else {
            setPrinted(true);
            return "(" + Joiner.on(" | ").join(getNested().values()) + ")";
        }
    }

}
